package com.jason.system.common.util;

import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author jie
 * @version 1.0
 * success come from self-discipline
 * @date 2021/3/29 15:30
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Pager<T> {

  /**
   * 当前页
   */
  private int pageNum;
  /**
   * 每页的数量
   */
  private int pageSize;

  /**
   * 当前页的数量
   */
  private int size;

  /**
   * 总页数
   */
  private int pages;

  /**
   * 结果集
   */
  private List<T> list;
  /**
   * 总记录条数
   */
  private long total;

  public Pager(PageInfo<T> pageInfo){
    this.pageNum = pageInfo.getPageNum();
    this.pageSize = pageInfo.getPageSize();
    this.pages = pageInfo.getPages();
    this.size = pageInfo.getSize();
    this.list = pageInfo.getList();
    this.total = pageInfo.getTotal();
  }

}
